package com.augurit.gzcgwsp.ywcmn.convert;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.dozer.DozerBeanMapper;

import com.augurit.gzcgwsp.ywcmn.entity.YwComSjcllistOther;
import com.augurit.gzcgwsp.ywcmn.web.form.YwComSjcllistOtherForm;

public class YwComSjcllistOtherConvertor {
	public static YwComSjcllistOtherForm convertVoToForm(YwComSjcllistOther entity) {
		if (entity == null) return null;
		
		return new DozerBeanMapper().map(entity, YwComSjcllistOtherForm.class);
	}
	
	public static void convertFormToVo(YwComSjcllistOtherForm form, YwComSjcllistOther entity) {
		if (form == null) return;
		if (entity == null) entity = new YwComSjcllistOther();
		
		new DozerBeanMapper().map(form, entity);
	}
	
	public static List<YwComSjcllistOtherForm> convertVoListToFormList(List<YwComSjcllistOther> ywComSjcllistList) {
        List<YwComSjcllistOtherForm> ywComSjcllistFormList = new ArrayList<YwComSjcllistOtherForm>();
		if(ywComSjcllistList != null && ywComSjcllistList.size() > 0) {
			for(int i=0; i<ywComSjcllistList.size(); i++) {
				ywComSjcllistFormList.add(convertVoToForm(ywComSjcllistList.get(i)));
			}
		}
		return ywComSjcllistFormList;
	}
	
	public static List<YwComSjcllistOther> convertFormListToVoList(List<YwComSjcllistOtherForm> ywComSjcllistFormList) {
		if(ywComSjcllistFormList != null && ywComSjcllistFormList.size() > 0) {
			List<YwComSjcllistOther> ywComSjcllistList = new ArrayList<YwComSjcllistOther>();
			for(int i=0; i<ywComSjcllistFormList.size(); i++) {
				YwComSjcllistOther ywComSjcllist = new YwComSjcllistOther();
				convertFormToVo(ywComSjcllistFormList.get(i), ywComSjcllist);
				ywComSjcllistList.add(ywComSjcllist);
			}
			return ywComSjcllistList;
		}
		return null;
	}
}